package com.cskaoyan.dbutils;

import com.cskaoyan.others.DruidUtils;
import com.cskaoyan.vo.Account;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.ResultSetHandler;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * 创建日期: 2021/11/25 16:00
 *
 * @author ciggar
 */
public class DBUtilsDemo3 {

    public static void main(String[] args) throws SQLException {

        // 1. 获取QueryRunner
        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());

        // 2. 执行SQL语句
        Account account = queryRunner.query("select * from account where id = ?",new MyResultSetHandler(), 1);

        System.out.println(account);
    }
}
